-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(react): Add POP
guard for long-running pageload
spans
#17867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix(react): Add POP
guard for long-running pageload
spans
#17867
Conversation
c5b63b9
to
b3027fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find! Any way we can test this in e2e?
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
return; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Race Condition in Pageload Completion Logic
The pageload completion logic has a race condition. It can prematurely mark pageload as complete if the root span is missing, not necessarily because pageload finished. This causes legitimate POP
navigation events immediately following pageload to be incorrectly ignored.
This resolves the issue that occurs when an extra
navigation
transaction is created after a prematurely endedpageload
transaction in React Router lazy routes.This apparently occurs when there's a long-running pageload with lazy-routes (after fetching assets, there are multiple potentially long-running API calls happening).
This causes the
pageload
transaction to prematurely end, even before the fully parameterized transaction name is resolved. The reason is that there can be aPOP
event emitted, which we subscribe to create anavigation
transaction. This ends the ongoingpageload
transaction before its name is updated with a resolved parameterized route path, and starts anavigation
transaction, which contains the remaining spans that were supposed to be a part of thepageload
transaction.This fix makes sure the initial
POP
events are not necessarily treated asnavigation
pointers, which should fix both:navigation
transactions having a part ofpageload
spans.pageload
transaction names